/**
 * 通用混合
 * */

export default {
  methods: {
    // 当 $route 更新时触发
    appRouteChange(to, from) {
      // 企业信息详情
      let compantInfo = ["enterpriseInforDetail", "changeRecord"];
      if (compantInfo.includes(to.name)) {
        this.$store.commit(
          "admin/menu/setActivePath",
          "/enterpriseInforInquiry"
        );
        this.$store.commit("admin/menu/setOpenNames", [
          "/enterpriseInforManage",
        ]);
      }

      if (to.name == "enterpriseDetail") {
        this.$store.commit(
          "admin/menu/setActivePath",
          "/enterpriseInforExamine"
        );
        this.$store.commit("admin/menu/setOpenNames", [
          "/enterpriseInforManage",
        ]);
      }

      if (to.name == "changeRecordDetail") {
        this.$store.commit(
          "admin/menu/setActivePath",
          "/enterpriseInforInquiry"
        );
        this.$store.commit("admin/menu/setOpenNames", [
          "/enterpriseInforManage",
        ]);
      }

      if (to.name == "businessInformationDetails") {
        this.$store.commit(
          "admin/menu/setActivePath",
          "/businessInformationManage"
        );
      }

      // 经营预警详情
      if (to.name == "businessInfoWarningDetails") {
        this.$store.commit(
          "admin/menu/setActivePath",
          "/businessInformationWarning"
        );
        this.$store.commit("admin/menu/setOpenNames", [
          "/businessInformationTracking",
        ]);
      }

       // 经营预警详情
       if (to.name == "businessInfoTrackDetails") {
        this.$store.commit(
          "admin/menu/setActivePath",
          "/businessInformationManage"
        );
        this.$store.commit("admin/menu/setOpenNames", [
          "/businessInformationManage",
        ]);
      }
      ;
    },
  },
};
